package com.anng.hosp.controller;

import com.anng.common.result.Result;
import com.anng.hosp.model.hosp.Hospital;
import com.anng.hosp.service.HospitalService;
import com.anng.hosp.vo.hosp.HospitalQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.service.Tags;

import java.util.List;
import java.util.Map;

/**
 * @author Morgan
 * @create 2021-12-26-15:15
 */

//@Api(tags = "医院控制系统")
@CrossOrigin  //解决跨域问题 8201 与 9528的跨域访问// 新加 可删就是跨域问题
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalController {

    @Autowired
    private HospitalService hospitalService;

    //医院列表(条件查询分页)
    @GetMapping("list/{page}/{limit}")
    public Result listHosp(@PathVariable Integer page,
                           @PathVariable Integer limit,
                           HospitalQueryVo hospitalQueryVo) {
        Page<Hospital> pageModel = hospitalService.selectHospPage(page,limit,hospitalQueryVo);
        List<Hospital> content = pageModel.getContent();
        long totalElements = pageModel.getTotalElements();
        return Result.ok(pageModel);
    }
<<<<<<< HEAD

    //更新医院上线状态
    @ApiOperation("更新医院上线状态")
    @GetMapping("updateHospStatus/{id}/{status}")
    public Result updateHospStatus(@PathVariable String id,@PathVariable Integer status){
            hospitalService.updateStatus(id,status);
            return Result.ok();
    }

    //医院详情信息
    @ApiOperation("医院详情信息")
    @GetMapping("showHospDetail/{id}")
    public Result showHospDetail(@PathVariable String id){
        Map<String,Object> map = hospitalService.getHospById(id);
        return Result.ok(map);
    }

=======
    /*gap*/

//
//    //更新医院上线状态
//    @ApiOperation(value = "更新医院上线状态")
//    @GetMapping("updateHospStatus/{id}/{status}")
//    public Result updateHospStatus(@PathVariable String id,@PathVariable Integer status) {
//        hospitalService.updateStatus(id,status);
//        return Result.ok();
//    }
>>>>>>> e2606adf7a07ae4b7378a6e755df44c7dfd149bd
//
//    //医院详情信息
//    @ApiOperation(value = "医院详情信息")
//    @GetMapping("showHospDetail/{id}")
//    public Result showHospDetail(@PathVariable String id) {
//        Map<String, Object> map = hospitalService.getHospById(id);
//        return Result.ok(map);
//    }



}
